package com.abc.liuyan;

import javax.annotation.Resource;
import javax.validation.Validator;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.context.MessageSource;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ImportResource;
import org.springframework.validation.beanvalidation.LocalValidatorFactoryBean;

import tk.mybatis.spring.annotation.MapperScan;

/**
 *
 * @author huangxin <3203317@qq.com>
 *
 */
// @EnableRedisHttpSession
@EnableDiscoveryClient
@ImportResource(locations = { "classpath:spring-all.xml" })
@MapperScan(basePackages = "com.abc.liuyan.mapper")
@SpringBootApplication(scanBasePackages = { "com.abc.annotation",
		"com.abc.shiro", "com.abc.liuyan" })
public class RunLAppClient implements CommandLineRunner {

	private static final Logger logger = LoggerFactory
			.getLogger(RunLAppClient.class);

	public static void main(String[] args) {
		SpringApplication.run(RunLAppClient.class, args);
	}

	@Override
	public void run(String... args) throws Exception {
		logger.info("服务启动完成");

	}

	@Resource
	private MessageSource messageSource;

	@Bean
	public Validator getValidator() {
		LocalValidatorFactoryBean _vali = new LocalValidatorFactoryBean();
		_vali.setValidationMessageSource(messageSource);
		return _vali;
	}

}
